// Dialog.js
import React from 'react';

const Dialog = ({ message, onClose }) => {
  if (!message) return null;  // 如果没有信息则不渲染

  return (
    <div style={styles.dialogBackdrop}>
      <div style={styles.dialog}>
        <h3>操作结果</h3>
        <p>{message}</p>
        <button onClick={onClose}>关闭</button>
      </div>
    </div>
  );
};

const styles = {
  dialogBackdrop: {
    position: 'fixed',
    top: 0,
    left: 0,
    width: '100%',
    height: '100%',
    backgroundColor: 'rgba(0, 0, 0, 0.5)',
    display: 'flex',
    justifyContent: 'center',
    alignItems: 'center',
  },
  dialog: {
    backgroundColor: 'white',
    padding: '20px',
    borderRadius: '10px',
    textAlign: 'center',
  },
};

export default Dialog;
